import numpy as np
from pygame.examples.sprite_texture import group


def cul():
    results=[]
    p0=1.0133
    for i in range(6):
        print("请输入第{i+1}组数据")
        u1=float(input("第一个电压>"))
        u2=float(input("第二个电压>"))
        p1=p0+u1/2000
        p2=p0+u2/2000
        rate1=p1/p0
        rate2=p1/p2
        logValue1=np.log10(rate1)
        logValue2=np.log10(rate2)
        result={
            "group>":i+1,
            "u1>":u1,
            "u2>":u2,
            "p1>":p1,
            "rate1>":rate1,
            "logValue1>":logValue1,
            "p2>":p2,
            "rate2>":rate2,
            "logValue2>":logValue2
        }
        results.append(result)
        return results

# 执行计算
results = cul()

# 显示结果
print("\n计算结果:")
for i in results:
    print(f"第{i["group"]}组，其中u1为{i["u1"]}，u2{i["u2"]}")
    print(f"p1为{i["p1"]}，p2为{i["p2"]}")
    print(f"p1/p0为{i["rate1"]},p1/p2为{i["rate2"]}")
    print(f"lg(p1/p0)为{i["logValue1"]}，lg(p1/p2)为logValue2")
    print()

